package com.cbg.es.service.impl;

import com.cbg.dto.SelectedColListDTO;
import com.cbg.es.entity.EsTableCol;
import com.cbg.es.repository.IEsTableColRepository;
import com.cbg.es.service.IEsTableColService;
import com.shuyuwl.core.enums.StatusEnum;
import com.shuyuwl.core.exception.SymServiceException;
import com.shuyuwl.core.service.impl.DaoServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

/**
 * 分类下展示的表所需要的字段 serviceImpl
 *
 * @author wangjuzheng
 * @since 2019-10-16
 */
@Service
@Transactional(rollbackFor = SymServiceException.class)
public class EsTableColServiceImpl extends DaoServiceImpl<EsTableCol, Long, IEsTableColRepository> implements IEsTableColService {

    @Resource
    private IEsTableColRepository esTableColRepository;

    @Override
    public List<SelectedColListDTO> selectedTableCategory(Long esTableCategoryId) {
        return esTableColRepository.selectedTableCategory(esTableCategoryId, StatusEnum.DELETE.getCode(), StatusEnum.OK.getCode());
    }
    @Override
    public EsTableCol findById(Long id) {
        return esTableColRepository.findByIdAndStatusLessThan(id, StatusEnum.DELETE.getCode());
    }

}
